<script type="text/javascript">
    $().ready(function(){


    });
</script>
<h1>Browsing for</h1>



<?php if ($searchTags): ?>
    <div class="tag-browse-tags">
        <h2>Browsing Tags</h2>
        <p class=".action-hint">Click on a tag to remove it from the search</p>
        <ul id="search-tags-list">
        <?php foreach ($searchTags as $searchTag): ?>
            <li class="search-tag">
                <a href="<?php echo url_for('TagBrowse', array('tags' => preg_replace('/(,\s*' . $searchTag . '|' . $searchTag . ',\s*|' . $searchTag . ')/i', '', $tagString))) ?>">
                <?php echo $searchTag ?>
            </a>
        </li>
        <?php endforeach; ?>
            </ul>
        </div>
<?php else: ?>

                    <div class="tag-select-tags">
                        <h2>Select Tags</h2>
                        <p class=".action-hint">Select tags to browse with</p>
                        <ul id="search-tags-list">
        <?php foreach ($allTags as $searchTag): ?>
                        <li class="search-tag">
                            <a href="<?php echo url_for('TagBrowse', array('tags' => $searchTag->getTypeName())) ?>">
                <?php echo $searchTag ?>
                    </a>
                </li>
        <?php endforeach; ?>
                    </ul>
                </div>
<?php endif; ?>


<?php if (($relatedTags) && (sfConfig::get('app_features_enable_related_tags'))): ?>
                            <div class="tag-related-tags">
                                <h2>Related Tags</h2>
    <?php if (count($relatedTags) > 0): ?>
                                <p class=".action-hint">Click on a tag to add it to the search</p>
                                <ul id="search-tags-list">
        <?php foreach ($relatedTags as $relatedTag): ?>
                                    <li class="search-tag">
                                        <a href="<?php echo url_for('TagBrowse', array('tags' => $tagString . ',' . $relatedTag)) ?>">
                <?php echo $relatedTag ?>
                                </a>
                            </li>
        <?php endforeach; ?>
                                </ul>
    <?php else: ?>
                                        <p class=".action-hint">No related tags found </p>
    <?php endif; ?>
                                    </div>
<?php endif; ?>
<?php if ($searchResults != null): ?>
                                            <div class="tag-browse-results">
                                                <h1>Tagged Collections</h1>
    <?php include_partial('collectionListView', array('collectionItemList' => $searchResults)) ?>
                                        </div>
<?php endif; ?>